<!DOCTYPE html>
<!--
This is a starter template page. Use this page to start your new project from
scratch. This page gets rid of all links and provides the needed markup only.
-->
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta http-equiv="x-ua-compatible" content="ie=edge">

  <title>{$SETTING.website_name}</title>

  {include file="../Common/cssjs"}
</head>

<body class="hold-transition sidebar-mini">
  <div class="wrapper">

    {include file="../Common/navbar"}

    {include file="../Common/sidebar"}



    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">

      <!-- Main content -->
      <div class="content">
          <div class="container-fluid">
              <div class="row">
                <!-- /.col-md-12 -->
                <div class="col-lg-12">
                  <div class="card card-primary">
                    <div class="card-header">
                      <h3 class="card-title">分类列表</h3>
                    </div>
                    <!-- /.card-header -->
                    <table class="table table-bordered table-hover" width="100%">
                    
                        <tr>
                          <td colspan="7" align="center">
                          <p class="mysearch_item">搜索：<input type="text" name="" id="searching"> </p>
                          <p class="mysearch_item2"><input class="btn btn-primary" type="button" value="搜索" id="to_search"> <input type="button" class="btn btn-warning" value="重置" id="to_reset"></p>
                          </td>
                        </tr>
                        
                        </table>
                        <table class="table table-bordered table-hover" width="100%">
                          <tr><td align="center"><input class="btn btn-primary" type="button" value="更新分类缓存" onClick="location.href='{$CATEGORY_CACHE_URL}';"></td></tr>
                        </table>
                        <div class="box-body table-responsive no-padding">
                        <table class="table table-bordered table-hover mytable" width="100%">
                        <tr>
                          <td>名称</td>
                          <td align="center">分类ID</td>
                          <td align="center">路径</td>
                          <td align="center">编辑</td>
                          <td align="center">删除</td>
                        </tr>
                        {foreach $category_arr as $key => $value}
                        <tr>
                          <td>
                          {:str_repeat('&nbsp;',$value['lev']*4)}┖─&nbsp;<strong>{$value['catname']}</strong>
                          </td>
                        <td align="center">{$value['catid']}</td>
                        <td align="center">{$value['cat_pos']|raw}</td>
                        <td align="center"><a href="{$CATEGORY_MOD_URL}?catid={$value['catid']}" class="btn btn-info btn-sm"><i class="fas fa-pencil-alt">
                          </i> 编辑 </a></td>
                        <td align="center"><a onClick="return confirm('确定要删除么？');" href="{$CATEGORY_DEL_URL}?catid={$value['catid']}" class="btn btn-danger btn-sm"><i class="fas fa-trash">
                          </i> 删除 </a></td>
                        </tr>
                        {/foreach}
                        </table>    
                  </div>
                  </div>
                </div>
    
    
    
                <!-- /.col-md-12 -->
              </div>
              <!-- /.row -->
            </div><!-- /.container-fluid -->
      </div>
      <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->

    <!-- Control Sidebar -->
    <aside class="control-sidebar control-sidebar-dark">
      <!-- Control sidebar content goes here -->
      <div class="p-3">
        <h5>Title</h5>
        <p>Sidebar content</p>
      </div>
    </aside>
    <!-- /.control-sidebar -->


    {include file="../Common/footer"}
  </div>
  <script>
      $(document).ready(function(e) {
          $('#to_search').click(function(){
          var txt=$('#searching').val();
          if(txt===''){
            $('#to_reset').click();	
          }
          $('.mytable:eq(0) tr').each(function(index, element) {
                  var a=$(element).find('td').eq(0).text();
            if(a.indexOf(txt)>-1){
              $(element).show();	
            }else{
              $(element).hide();
            }
              });
          
        });
        $('#to_reset').click(function(){
          $('.mytable:eq(0) tr').show();
          $('#searching').val('');
        });
      });
      </script>
</body>

</html>